package com.miaomiao.algorithm.sqlutil;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.commons.io.FileUtils;

/**
 * <p>Title: BatchInsertSQL</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: http://www.croot.com/</p>
 *
 * @author: cw
 * @Date: 2022/7/4 10:30
 */
public class BatchInsertSQL {

  public static void main(String[] args) throws IOException {

    String
        insertSQL =
        "INSERT INTO ev_compute_mapping (configId,defineId,priority,createTime,updateTime) VALUES (%d,%d,%d,'2022-05-07 16:20:04.0','2022-05-07 16:20:11.0');";
    String delSQL = "delete from ev_compute_mapping where configId = %d;";
    int configId = 168;
    File file = new File("G:\\123.txt");

    List<String> strings = FileUtils.readLines(file, "utf-8");

    String realdelSQL = String.format(delSQL, configId);
    System.out.println(realdelSQL);
    for (int i = 0; i < strings.size(); i++) {
      String format = String.format(insertSQL, configId, Integer.valueOf(strings.get(i)), i);

      System.out.println(format);
    }

  }

}


